# /bin/bash
#  总体原则：先配置好镜像再下载

# export HOMEBREW_NO_AUTO_UPDATE=true

# 0 安装xcode 命令
xcode-select --install

# 1. 安装
if test ! $(which brew); then
    echo "Installing homebrew..."
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
fi
brew update

# https://juejin.im/post/5c738bacf265da2deb6aaf97
# https://wsgzao.github.io/post/homebrew-bundle/